package com.littleshu.test;


/**
 * 题目：输入两个正整数m和n，求其最大公约数和最小公倍数<br>
 * 程序分析：懂数学就比较好做了,最大公约数＝两数乘积/最小公倍数<br>
 * 
 * @author littleshu
 *
 */
public class Question6 implements RunTest {
	
	public static void main(String[] args) {
		new Question6().runTest();
	}

	@Override
	public void runTest() {
		int m = 888;
		int n = 3;
		// 最小公倍数
		int lowestCommonMultiple = m;
		// 最大公约数
		int maxCommonDivisor = n;
		int i = 1;
		do {
			if (lowestCommonMultiple % n == 0) {
				break;
			}
			lowestCommonMultiple = m * i;
			System.out.println(lowestCommonMultiple);
			i++;
		} while (true);
		maxCommonDivisor = (m * n) / lowestCommonMultiple;
		System.out.println(m + "和" + n + "的最小公倍数是：" + lowestCommonMultiple + "， 最大公约数是：" + maxCommonDivisor);
	}

}
